package com.vogue.supplymall.match.domain.mapper;

import java.util.List;

import org.apache.ibatis.annotations.*;

import com.vogue.ssm.database.util.SqlLangDriver;
import com.vogue.supplymall.match.domain.model.MatchOrgan;

@Mapper
public interface MatchOrganMapper extends BaseMapper<MatchOrgan, Long>{

	@Select("select id from match_organ where sysCodeId=#{arg0} and matchid=#{arg1}")
	@Lang(SqlLangDriver.class)
	public List<Long> checkOrganIsExist(Long sysCodeId,String matchId);

	@Select("select matchid from match_organ where  matchId IS NOT NULL AND matchid !='woshigeren' and sysCodeId=#{sysCodeId} and type=1")
	@Lang(SqlLangDriver.class)
	public List<String> getAllOrganIdBySysCode(Long sysCodeId);

	@Select("select * from match_organ where sysCodeId=#{arg0} and matchid=#{arg1}  order by disabledflag")
	@Lang(SqlLangDriver.class)
	public List<MatchOrgan> getMatchOrganByMatchId(Long sysCodeId,String matchId);
	
	@Select("select * from match_organ where sysCodeId=#{arg0} and type=1  order by disabledflag")
	@Lang(SqlLangDriver.class)
	public List<MatchOrgan> getEnterpriseByMatchId(Long sysCodeId);

	/**
	 * Count valid shop long.
	 * admin-business使用，查询所有开通的店铺
	 *
	 * @return the long
	 */
	@Select("select COUNT(DISTINCT syscodeid) from match_organ where disabledflag = 0 and type = 1;")
	Long countValidOrgan();
}
